<template>
  <div id="search">
    <van-sticky>
      <div class="navsearch">
        <div class="search">
          <div class="search_first">
            <p>杭州</p>
            <van-icon name="arrow-down" class="icon_onw" />
          </div>
          <p class="search_conter">|</p>
          <div class="search_last" @click="nsearch">
            <van-icon size="17" name="search" class="icon_two" />
            <input type="text" v-model="tipes" />
          </div>
        </div>
      </div>
    </van-sticky>
    <div class="newlist" v-show="navShow">
      <div class="hot">
        <p id="now">热门搜索</p>
        <div class="hot_div">
          <div class="hot_div_first" v-for="item in 10" :key="item.id">
            <p>张家界</p>
          </div>
        </div>
      </div>
      <div class="raiw">
        <span>搜索历史</span>
        <div class="raiw_div">
          <div class="raiw_div_first">
            <p>长白山</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      navShow: true,
      tipes: "请输入关键字",
    };
  },
  methods: {
    nsearch() {
      this.navShow = !this.navShow
    },
    init() {},
  },
  mounted() {
    this.init();
  },
};
</script>

<style lang="scss" scoped>
#search {
  width: 100vw;
  height: 100vh;
  background-color: #fff;
  position: fixed;
}
.navsearch {
  width: 100%;
  height: 50px;
  background-color: #fff;
  position: fixed;
  top: 0;
  z-index: 999;
  transition: 0.5s;
  .search {
    position: sticky;
    width: 355px;
    height: 41px;
    border-radius: 50px;
    top: 7px;
    left: calc((100% - 355px) / 2);
    display: flex;
    padding: 0 15px;
    background-color: #f2f3f7;
    z-index: 1;
    .search_first {
      width: 65px;
      height: 41px;
      display: flex;
      line-height: 41px;
      justify-content: center;
      .icon_onw {
        top: 13px;
      }
    }
    .search_conter {
      line-height: 41px;
      color: #79757537;
    }
    .search_last {
      width: 260px;
      height: 41px;
      line-height: 41px;
      text-align: center;
      .icon_two {
        top: 1px;
      }
    }
  }
}
.newlist {
  .hot {
    margin-top: 50px;
    padding: 14px;
    #now {
      font-size: 14px;
      color: #9999;
      margin-bottom: 10px;
    }
    .hot_div {
      display: flex;
      flex-wrap: wrap;
      .hot_div_first {
        width: 69px;
        height: 30px;
        background-color: #f4f6f8;
        border-radius: 4px;
        line-height: 30px;
        text-align: center;
        margin: 0 0 10px 10px;
        p {
          color: #666;
        }
      }
    }
  }
  .raiw {
    padding: 14px;
    span {
      font-size: 14px;
      color: #9999;
      margin-bottom: 10px;
    }
    .raiw_div {
      margin-top: 10px;
      display: flex;
      flex-wrap: wrap;
      .raiw_div_first {
        width: 69px;
        height: 30px;
        background-color: #f4f6f8;
        border-radius: 4px;
        line-height: 30px;
        text-align: center;
        margin: 0 0 10px 10px;
        p {
          color: #666;
        }
      }
    }
  }
}
</style>
